﻿/*<summary>
Created By : Swati
Created On : 10/25/2008
Class Name : PatientConsultantVisit_Mapper
Used In    : 
------------------------------------------------------------------------
Modification Log  
------------------------------------------------------------------------
Created By        Modified By         Remarks                             
-----------       ------------        ----------------------------------
                                                                          
------------------------------------------------------------------------
</summary>*/

using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Utils;

namespace RegistrationController
{
    public class PatientConsultantVisit_Mapper
    {
        public bool add_consultant_visit(string CRNumber,
                                         string consultantName)
        {
            bool bresult;
            int ResultVal;
            ezUtilsAdapter DBL = new ezUtilsAdapter();
               
            try
            {
                ResultVal = DBL.RunSPReturnInteger("SP_SetPatientConsultantVisit",
                                    new SqlParameter("@biCRN", CRNumber),
                                    new SqlParameter("@vchConsultant", consultantName));
                if (ResultVal == 0) { bresult = true; } else { bresult = false; } return bresult;
            }
            catch (SqlException ex)
            {
                string errorMessage = string.Format(
                    "An Error Occurred While Loading the Consultant Visit Information to the DB. Message: {0}", ex.Message);
                //throw new MappingException(errorMessage, ex);}
                return false;
            }
            finally
            {
                DBL.Dispose();
            }
        }

        public void Dispose()
        {
            this.Dispose(true);
            System.GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
        }
    }
}